package com.dayi.utils.pop;

import android.app.Activity;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.widget.LinearLayout;

import com.dayi.R;
import com.zyyoona7.popup.EasyPopup;

import androidx.cardview.widget.CardView;

public class QuestionTypePopupUtils {


    private Activity activity;

    public QuestionTypePopupUtils(Activity ac) {

        this.activity = ac;

        initAnswerPopuPopu();
    }

    private EasyPopup answerPopu;

    private void initAnswerPopuPopu() {
        answerPopu = EasyPopup.create()
                .setContext(activity)
                .setContentView(R.layout.popup_questiontype)

                .setWidth(WindowManager.LayoutParams.FILL_PARENT)

                .setHeight(WindowManager.LayoutParams.FILL_PARENT)

                .setOnViewListener(new EasyPopup.OnViewListener() {
                    @Override
                    public void initViews(View view, EasyPopup basePopup) {

                        initView(view);


                    }


                })
                .setFocusAndOutsideEnable(true)
                .apply();

    }


    private LinearLayout lin_type;

    private CardView card;

    private void initView(View view) {
        lin_type = view.findViewById(R.id.lin_type);
        card = view.findViewById(R.id.card);

        card.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
    }

    public void showAnswerPopuPopu(View view) {

        answerPopu.showAtLocation(view, Gravity.CENTER, 0, 0);
    }


}
